package com.qf.air.controller;

import com.qf.air.service.ElasticsearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * ES查询接口
 * @author zjw
 */
@RestController
public class ElasticsearchController {

    @Autowired
    private ElasticsearchService elasticsearchService;

    @PostMapping("/search/findCount")
    public long findCount(@RequestBody Map map) throws IOException {
        long count = elasticsearchService.findAirIndexCount(map);
        return count;
    }


    @PostMapping("/search/findData")
    public List<Map> findData(@RequestBody Map map) throws IOException {
        List<Map> data = elasticsearchService.findAirIndexData(map);
        return data;
    }

}
